<!DOCTYPE html>
<html>
<head>
<title>travelList.html</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link rel="stylesheet" href="css/pubStyle.css" />
<link rel="stylesheet" href="css/travel.css" />
<style type="text/css">
<!--
body {
    background-color:#F7F7F7;
    margin: 0px;
}
-->
</style>

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="js/cookie_util.js"></script>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/sofa.js"></script>
<script type="text/javascript" src="js/travel.js"></script>
<script type="text/javascript">
    var acctId = getCookie("uid");
    if (acctId == null) {
        window.location.href = "index.html";
    }
    var realName = getCookie("realName");
    var userType = getCookie("userType");
    $(function(){
        $("#acctId").html(realName);
        logOut();
        var page = getCookie("travelListPage");
        if(page==""||page==null){
            page = 1;
        }
        //获取沙旅列表
        getTravelList(page,"img/arcicon.gif");
        
        //发表沙旅
        $("#toursubmit").click(function(){
            var tatile = $("#tourtitle").val().trim();
            var tourType = $("#tourType").val().trim();
            var content = editor.getData();
            if(checkIsEmpty(tatile)){
                alert("请输入标题!");
                return;
            }
            $.ajax({
                url:"/SofaGuest/travel/createTravel.do",
                type:"post",
                data:{"author":acctId,"tatile":tatile,
                      "tourType":tourType,"content":content},
                dataType:"json",
                success:function(result){
                    alert(result.detial);
                    //获取沙旅列表
                    addCookie("page",1,2);//默认显示第一页
                    getTravelList(page,"img/arcicon.gif","yes");
                },
                error:function(){
                    alert("发表失败,请稍后重试!");
                }
            });
            
        });
        
        //按默认顺序查看沙旅
        $("#default").click(function(){
            //获取沙旅列表
            addCookie("page",1,2);//默认显示第一页
            getTravelList(page,"img/arcicon.gif","no");
        });
        
        //按时间顺序查看沙旅
        $("#byTime").click(function(){
            //获取沙旅列表
            addCookie("page",1,2);//默认显示第一页
            getTravelList(page,"img/arcicon.gif","yes");
        });
    });
    
</script>
</head>

<body>
  <div class="top">
    <div class="top-page">
      <div id="nav-title">
        <a href="homePage.html" class="title">首页</a>
        <a href="Javascript:void(0)" class="title" onclick="gotoqrySofaHtml()">找沙发</a>
                <!-- <a href="qrySofa.html" class="title">找沙发</a> --> 
        <a href="addSofa.html" class="title">我有沙发</a> 
        <a href="travelList.html" class="title">分享沙旅</a> 
        <a href="personMan.html" class="title">个人管理</a>
      </div>
      <div id="loginfo">
        <span>当前登陆：</span> <span id="acctId"></span> <span><a href="Javascript:void(0)" id="safeout"  target="_self">安全退出</a></span>
      </div>
    </div>
  </div>
  <div class="main-page">
    <div class="main-content">
      <div class="emp-line"></div>
      <div class="qrySofaimg" id="travel-title">
        <span>&nbsp;&nbsp;沙旅分享</span>
      </div>
      <div class="emp-line"></div>
      <div class="main-travel">
        <div id="content-list">
          <div id="content-title">
          	<label class="titlelabel"><a class="titlea" href="Javascript:void(0)" id="default">默认</a></label>
          	<label class="titlelabel"><a class="titlea" href="Javascript:void(0)" id="byTime">按时间</a></label>
          	<label class="titlelabel"><a class="titlea" href="#discussarea" id="">发帖</a></label>
          </div>
          <div id="content-role">
            <table class="travelnews" id="travelList">
               <!-- <tr>
                <td width="3%"><img src="img/arcicon.gif" />
                </td>
                <td width="80%"><a href="" class="newstitle">[我的沙旅]我是测试沙发沙发沙发。。。。</a>
                </td>
                <td width=7%;><span class="author">崔健</span>
                </td>
                <td width=10%;><span class="ctime">2017-04-16</span>
                </td>
              </tr>
              <tr>
                <td width="3%"><img src="img/arcicon.gif" />
                </td>
                <td width="80%"><a href="" class="newstitle">[我的沙旅]我是测试沙发沙发沙发。。。。</a>
                </td>
                <td width=7%;><span class="author">崔健</span>
                </td>
                <td width=10%;><span class="ctime">2017-04-16</span>
                </td>
              </tr>  -->
            </table>
          </div>
        </div>
        <div id="discussarea">
            <div class="emp-line"></div>
      <div class="qrySofaimg" id="travel-title">
        <span>&nbsp;&nbsp;编辑沙旅</span>
      </div>
      <div class="emp-line"></div>
          <!-- 总标题栏 -->
          <div>
            <span>编辑标题：</span> <input type="text" id="tourtitle"/> 
            <select id="tourType">
                <option value="1">沙发旅行</option>
                <option value="2">接待沙友</option>
            </select>
            <input type="button" value="发表" id="toursubmit"/>
          </div>
          <!-- 总编辑栏 -->
          <div>
            <textarea name="editor1" id="editor1" rows="10" cols="80">
                           
                    </textarea>
            <script type="text/javascript" >editor = CKEDITOR.replace('editor1');</script>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="feet">
		<a href="homePage.html">首页</a><span>|</span>
		<a href="addSofa.html">新增沙发</a><span>|</span>
		<a href="register.html">入驻沙主</a><span>|</span>
		<a href="personMan.html">信息管理</a><span>|</span>
		<a href="adminman.html">后台管理</a><span>|</span>
		<a href="index.html">退出登录</a>
	</div>
</body>
</html>
